/**
 * 系统
 */
$(document).ready(function(){
    Sys.init();
});
var Sys = {};
//初始系统
Sys.init = function()
{
    var _self = this;
    _self.load(function(){
        _self.event();
        $('.side-nav li a').first().click();
    });

}
//延迟加载
Sys.load = function(callback)
{
    var css = [
            PUBLIC+'/lib/My97DatePicker/skin/WdatePicker.css'
        ],
        js = [
            PUBLIC+'/js/SysParty.js',
            PUBLIC+'/js/SysMessage.js',
            PUBLIC+'/js/SysConfig.js',
            PUBLIC+'/lib/My97DatePicker/WdatePicker.js',
            PUBLIC+'/js/jquery.form.min.js',
            PUBLIC+'/js/jquery-ui-1.9.2.custom.js'
        ];
    LazyLoad.js(js, callback);
    LazyLoad.css(css, function () { });
}
//初始化事件
Sys.event = function()
{
    $('.popup .popup-close').click(function(){
        $(this).parent('.popup').fadeOut();
    });
    $('.side-nav li a').click(function(){
        var o = $(this),
            p = o.parent('li'),
            t = o.attr('rel'),
            to = $('#'+t);
        $('.side-nav li').not(p[0]).removeClass('active');
        p.addClass('active');
        $('.content').not(to[0]).slideUp();
        to.slideDown();
        if(t == 'party'){
            SysParty.init();
        }else if(t == 'message'){
            SysMessage.init();
        }else if(t == 'config'){
            SysConfig.init();
        }
    });
}